<template>
  <view class="tarbars">
    <u-tabbar v-model="current" :list="list"></u-tabbar>
  </view>
</template>

<script setup lang="ts">
import userSotre from '@/store/user';
import { onShow } from '@dcloudio/uni-app'
import { ref } from "vue";

import mallF from '@/static/images/tabbar/mall.png';
import mallT from '@/static/images/tabbar/mall-on.png';

import taskT  from "@/static/images/tabbar/task-hall-on.png"
import taskF from "@/static/images/tabbar/task-hall.png"


import listT from '@/static/images/tabbar/list-on.png';
import listF from '@/static/images/tabbar/list.png';

import msgF from '@/static/images/tabbar/msg.png';
import msgT from '@/static/images/tabbar/msg-on.png';

import personF from '@/static/images/tabbar/person.png';
import personT from '@/static/images/tabbar/person-on.png';
const userPinia = userSotre()
const list = ref()
const current = ref(0)

onShow(() => {
  let lis = [
    {
      iconPath: listF,
      selectedIconPath: listT,
      text: '订单',
      customIcon: false,
      pagePath: '/pages/order/list'
    },
    {
      iconPath: msgF,
      selectedIconPath: msgT,
      text: '消息',
      customIcon: false,
      pagePath: '/pages/news/news'
    },
    {
      iconPath: personF,
      selectedIconPath: personT,
      text: '我的',
      customIcon: false,
      pagePath: '/pages/my/my'
    }
  ]
  if (userPinia.isLoginType == 3) {
    //
    // lis.unshift(
    // 	{
    // 		iconPath: mallF,
    // 		selectedIconPath: mallT,
    // 		text: '产品',
    // 		customIcon: false,
    // 		pagePath: '/pages/order/manage'
    // 	},
    // )

    lis.splice(1, 0, {
      iconPath: mallF,
      selectedIconPath: mallT,
      text: '产品',
      customIcon: false,
      pagePath: '/pages/order/manage'
    })
  } else{
    lis.splice(1,0,{
      iconPath: taskF,
      selectedIconPath: taskT,
      text: '任务大厅',
      customIcon: false,
      pagePath: '/pages/task/taskHall'
    })
  }
  list.value =  lis
})
</script>

<style lang="scss" scoped>
.tarbars {
  overflow: hidden;
}
</style>
